package com.wanmait.schedule.manageController;


import com.wanmait.schedule.entity.Admin;
import com.wanmait.schedule.service.AdminService;
import com.wanmait.schedule.util.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("Manage")
public class LoginController {
    @Resource
    private AdminService adminService;
    @PostMapping("Login")
    public Result Login(@RequestBody Admin admin){
        List<Admin> select = adminService.select(admin);
        if(select.size()==0){//登录失败
            Result.success(select);
            return Result.error();//没这个管理员
        }
        else {//登陆成功
            return Result.success(select); //有这个管理员
        }
    }
}
